<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAppUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('app_user', function (Blueprint $table) {
//            $table->bigIncrements('id');
            $table->uuid('id');
            $table->string('name')->comment('用户名');
            $table->string('password')->comment('密码');
            $table->string('open_id')->unique()->comment('微信openId');
            $table->string('phone_number')->nullable()->comment('手机号');
            $table->string('avatar')->nullable()->comment('头像');
            $table->string('id_card_no')->nullable()->comment('身份证号');
            $table->tinyInteger('gender')->default(2)->comment('性别:0女,1男,2未知');
            $table->bigInteger('point')->default(0)->comment('会员积分');
            $table->string('country')->nullable()->comment('国家');
            $table->string('city')->nullable()->comment('城市');
            $table->string('language')->nullable()->comment('语言');
            $table->string('nick_name')->nullable()->comment('昵称');
            $table->string('passport')->nullable()->comment('护照');
            $table->date('birthday')->nullable()->comment('生日');
            $table->string('area')->nullable()->comment('地区');
            $table->string('company')->nullable()->comment('公司名称');
            $table->string('worker_address')->nullable()->comment('工作地址');
            $table->date('worker_time')->nullable()->comment('入职时间');
            $table->string('worker_level')->nullable()->comment('职位职级');
            $table->string('income')->nullable()->comment('收入区间');
            $table->string('house')->nullable()->comment('房产信息');
            $table->string('car_a')->nullable()->comment('车辆行驶证主页');
            $table->string('car_b')->nullable()->comment('车辆行驶证副页');
            $table->string('id_card_a')->nullable()->comment('身份证正面');
            $table->string('id_card_b')->nullable()->comment('身份证反面');
            $table->string('school')->nullable()->comment('学校');
            $table->json('location')->nullable()->comment('地理位置');

            $table->primary('id');
            $table->index('open_id');
            $table->index('name');
            $table->index('phone_number');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('app_user');
    }
}
